package com.ssy.lingxi.contract.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 合同动作
 * @author ds
 * @date 2021/5/22
 * @version 2.0.0
 */
public enum ContractActionEnum {

    ALL(0, "所有状态"),
    ADD(1, "新增合同"),
    SUBMIT_VALIFY(2, "提交审核合同"),
    EXAMINE_1(3, "审核合同(一级)"),
    EXAMINE_2(4, "审核合同(二级)"),
    SIGN(5, "签订合同"),
    SIGN_PARTY_A(6, "甲方签订合同"),
    SIGN_PARTY_B(7, "乙方签订合同"),
    INVALID(8, "作废"),
    SUBMIT(9, "提交"),
    ;
    private final Integer code;
    private final String message;

    ContractActionEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(ContractActionEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }
}
